package servlets;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

public class LoginAction extends Action {
	public ActionForward execute(final ActionMapping pMapping,
			ActionForm pForm, final HttpServletRequest request,
			final HttpServletResponse response) {
		if (request.getMethod().equals("POST")) {
			String name = request.getParameter("name");
			String password  =  request.getParameter("password");
			if ( name.equals(password))
			{
				return pMapping.findForward("accueil");
			}
			else
			{
				return pMapping.findForward("error");
			}
			
		}
		return null;
	}
}